Next | Prev | Up | Top | Contents | Index

Equipped Device Table (EDT) Changes

The form of the structures for the Equipped Device Table (EDT) have changed for the same reasons as the VECTOR line in the configuration (the VECTOR information is used as initialization values for the EDT entries).

The following information is from /usr/include/sys/edt.h:

#define NBASE 3
typedef unsigned long iopaddr_t;
typedef struct iospace {
   unchar    ios_type;     /* io space type on the adapter */
   iopaddr_t ios_iopaddr;  /* io space base address */
   ulong     ios_size;
   caddr_t   ios_vaddr;    /* kernel virtual address */
} iospace_t;

typedef struct edt {
   uint_t    e_bus_type;   /* vme, scsi, eisa... */
   unchar    v_cpuintr;    /* cpu to send intr to */
   unchar    v_setcpuintr; /* cpu field is valid */
   uint_t    e_adap;       /* adapter */
   uint_t    e_ctlr;       /* controller identifier */
   void*     e_bus_info;   /* bus-dependent info */
   int       (*e_init)();  /* device init/run-time probe */
   iospace_t e_space[NBASE];
} edt_t;

#define    e_base e_space[0].ios_vaddr
#define    e_base2 e_space[1].ios_vaddr
#define    e_base3 e_space[2].ios_vaddr
#define    e_iobase e_space[0].ios_iopaddr
#define    e_iobase2 e_space[1].ios_iopaddr
#define    e_iobase3 e_space[2].ios_iopaddr

The e_bus_info field points to the following structure:

typedef struct vme_intrs {
   int (*v_vintr)();        /* interrupt routine */
   unsigned    char v_vec;  /* vme vector */
   unsigned    char v_brl;  /* interrupt priority level */
   unsigned    char v_unit; /* software identifier */
} vme_intrs_t;

The following fragment illustrates an edtinit routine using the new structures and the new pio_* routines.

mydrvredtinit(struct edt *e)
{
   piomap_t *piomap;
   vme_intrs_t *intrs = e->e_bus_info;
[...]
 piomap = pio_mapalloc(e->e_bus_type, e->e_adap, 
   &e->e_space[0], PIOMAP_FIXED, "mydrvr");

 if (piomap == 0) {
      /* This could fail because the adapter isn't valid
       * or invalid addresses or there are no more
       * fixed mappings available in the case of A32.
       */
      printf("mydrvr not installed\n");
      return;
   }

 e->e_base = pio_mapaddr(piomap, e->e_iobase);

   /* You can now use e->e_base as a normal address 
    * to access your controller.
    */
[...]
/* Now allocate a VME IRQ vector and register 
    * the interrupt routine.
    */
 ipl = intrs->v_brl;

 
 vec = vme_ivec_alloc(e->e_adap);

 if (vec == -1) {
 cmn_err(CE_WARN,"mydrvredtinit: no interrupt vector\n");
 pio_mapfree(piomap);
 return;
 }
 vme_ivec_set(e->e_adap, vec, mydrvrintr, e->e_ctlr);
[...]
}

Next | Prev | Up | Top | Contents | Index